﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.BIZ;
using AnyOffice.Components;
using AnyOffice.DAL;
using log4net;
using System.Reflection;


namespace AnyOffice.general.vehicle
{
    public partial class photo : ModulePage
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            string cmdText = "select Photo from Vehicle where VehicleId=" + ((Request.QueryString["vehicle_id"] == null) ? "" : Request.QueryString["vehicle_id"].ToString()).ToString();
            base.Conn.Open();
            object obj2 = new SqlCommand(cmdText, base.Conn).ExecuteScalar();
            if (obj2 != DBNull.Value)
            {
                byte[] buffer = (byte[])obj2;
                MemoryStream stream = new MemoryStream();
                stream.Write(buffer, 0, buffer.Length);
                Bitmap bitmap = new Bitmap(stream);
                Response.ContentType = "image/jpeg";
                bitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
            }
        }

    }
}
